//变量
var win_width = $(window).width(),
    win_height = $(window).height();
//轮播图
var swiper = new Swiper('.swiper-container', {
    pagination: '.swiper-pagination',
    paginationClickable: true,
    loop: true,
    autoplay: 3000
});
//放大图片左右切换滑动
var textContent, swiper4;
var fn = {

    //图片放大方法封装
    amplification: function (content, callback) {
        $('.at-amplification .swiper-wrapper').html(content);
        $('.mask, .at-amplification').show();
        $('.at-amplification').click(function () {
            $('.mask, .at-amplification').hide();
            $('body').css({'overflow': 'visible', 'position': 'relative'});
        });
    }

}

/*图片放大*/
$('.at-album-list img').on('click', function () {
    var content = $(this).parent().parent().parent('.swiper-slides').html();
    console.log(content);
    $('body').css({'overflow': 'hidden', 'position': 'fixed'});
    fn.amplification(content);
    $('.at-amplification .img-box').each(function () {
        var imgsrcsm = $(this).find('img').attr('src');
        var newimgsrc = imgsrcsm.split('&');
        $(this).find('img').attr('src', newimgsrc[0]);
    });
    $('.at-amplification .img-box').css({'height': win_height, 'width': win_width});
    var id = $(this).attr('data-id');
    if (swiper4) {
        swiper4.destroy(true, true);
    }
    swiper4 = new Swiper('.swiper-container4', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
        initialSlide: id,
        onSlideChangeStart: function (swiper) {
        }
    });
});

var imgnum = parseInt($(".at-album-list .swiper-slide").length);
$("#imgTotal").text(imgnum);


$(".bicon-like, .bicon-pk").on("click", function () {
    $(".alertbox").show();
});
$(".cancelBtn").on("click", function () {
    $(".alertbox").hide();
})

